<template>
  <el-table
    :data="reset"
    border
    @selection-change="change"
    style="width: 100%">
     <el-table-column
      type="selection"
      width="55">
    </el-table-column>
    <el-table-column
      prop="UserID"
      label="序号"
      width="100">
    </el-table-column>
    <el-table-column
      prop="RealName"
      label="姓名"
      width="180">
    </el-table-column>
    <el-table-column
      prop="SexFormat"
      label="性别">
    </el-table-column>
    <el-table-column
      prop="RealName"
      label="角色">
    </el-table-column>
    <el-table-column
      prop="DepartmentName"
      label="组织">
    </el-table-column>
    <el-table-column
      prop="LastModifyTime"
      :show-overflow-tooltip="true"
      width="180"
      label="最后登录时间">
    </el-table-column>
    <el-table-column
      prop="IP"
      :show-overflow-tooltip="true"
      label="登录IP">
    </el-table-column>
    <el-table-column
      prop="IsActiveFormat"
      label="状态">
    </el-table-column>
    <el-table-column
      width="180"
      label="操作">
      <template slot-scope="scope">
        <el-button
          size="mini"
          @click="handleDelete(scope.$index, scope.row)">踢人</el-button>
        <el-button
          size="mini"
          type="danger"
          @click="handleEdit(scope.$index, scope.row)">发送消息</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
  export default {
    props:{
        reset:{
          type:Array,
          required:true
        }
      },
    data() {
      return{

      }
    },
    methods:{
      change(val){
          let listId=[]
          val.forEach(el => {
              listId.push(el.UserID)
          });
          this.$emit('getId',listId)
        },
        handleDelete(data,row){
           this.$confirm('是否踢出该用户?', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.Proxy.invoke("serverKickUser",row.UserID)
        }).catch((error) => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
        },
        handleEdit(data,row){
          this.$emit('userId',row.UserID)
          this.$parent.dialogVisible=true
         
        }
    }
  }
</script>